home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2022 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  29 lines

  1. Newsgroups: comp.unix.osf.osf1,comp.lang.c
  2. Path: cwi.nl!dik
  3. From: dik@cwi.nl (Dik T. Winter)
  4. Subject: Re: printf-problem
  5. Message-ID: <DLDs8G.JJ9@cwi.nl>
  6. Sender: news@cwi.nl (The Daily Dross)
  7. Nntp-Posting-Host: chrysant.cwi.nl
  8. Organization: CWI, Amsterdam
  9. References: <4dj4g6$t9f@sunsystem5.informatik.tu-muenchen.de> <821915961snz@genesis.demon.co.uk>
  10. Date: Thu, 18 Jan 1996 14:29:04 GMT
  11.  
  12. In article <821915961snz@genesis.demon.co.uk> fred@genesis.demon.co.uk writes:
  13.  > In article <4dj4g6$t9f@sunsystem5.informatik.tu-muenchen.de>
  14.  >            wist@lam.mw.tu-muenchen.de "Henrik Wist" writes:
  15.  > >long int zahl;   /* which is e.g. 10000500001 */
  16.  > >printf("%d\n",zahl);      /* gives 1410565409, which is definitly wrong */
  17.  > >.
  18.  > >
  19.  > >Is that a problem of printf() or DG-UX or is it my problem that I don't know
  20.  > >the right conversion for printf(). Btw, printf("%u",zahl) didn't work either.
  21.  > RTFM. 'man printf' will almost certainly tell you that the conversion
  22.  > specifier for longs is %ld.
  23.  
  24. Alas, the FM will not tell him that the value is too large and does not
  25. fit in the variable zahl, so only the lower 32 bits are retained.
  26. -- 
  27. dik t. winter, cwi, kruislaan 413, 1098 sj  amsterdam, nederland, +31205924098
  28. home: bovenover 215, 1025 jn  amsterdam, nederland; http://www.cwi.nl/~dik/
  29.